#! /usr/bin/python3 python3
# -*- coding: utf-8 -*-

# *************************************************************
#  Projectname @  pysm
#     Filename @  login.py
#       Author @  Steve.ma
#  Create date @  2018/8/31
#  Description @  
# *************************************************************

from .. import api_blueprint
from Models.ApiController import *

class LoginController(ApiControllerModel) :
    Controller = 'Login'
    def index(self, params=None):
        #如果是Hprose传参判断以及验证
        self.setHproseParams(params);
        return self.returnMsg(True, {
            "token"     : "123",
            "userId"    : 2,
            "get_id"    : self.get("id", 0),
            "post_name" : self.post("name", 'sm'),
        })
    def id(self, params=None):
        #如果是Hprose传参判断以及验证
        self.setHproseParams(params);
        return self.returnMsg(True, {
            "token"     : "123",
            "args"      : params
        })


Controller = LoginController();

@api_blueprint.route('/login', methods=['GET', 'POST'])
def LoginIndex():
    return Controller.index()

@api_blueprint.route('/login/id/<int:id>', methods=['GET', 'POST'])
def LoginId(id):
    return Controller.id({
        'id' : id
    })